package com.czl.module_storehouse.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.SortBean;
import com.czl.module_base.utils.GlideUtils;
import com.czl.module_storehouse.R;

import java.util.List;

/**
 * @author xubin
 */
public class SortSearchListAdapter extends BaseQuickAdapter<SortBean, BaseViewHolder> {

    public SortSearchListAdapter(int layoutResId, @Nullable List<SortBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, SortBean item) {
        helper.setText(R.id.tv_goods_name, item.getSortName())
                .setText(R.id.tv_goods_model, "型号：" + item.getSortModel())
                .setText(R.id.tv_goods_stock, "库存：" + item.stockNum())
                .setText(R.id.tv_goods_use, "在用：" + item.stockNum());
        ImageView imageView = helper.getView(R.id.iv_goods);
        GlideUtils.loadImage(getContext(), imageView, item.getSortImg(), R.mipmap.pic_default_loading, R.mipmap.pic_default_error);
    }
}
